#!/bin/bash

echo "Hi! Let's install everything"

export DEBIAN_FRONTEND=noninteractive
sudo apt-get -yqq update
sudo apt-get -yqq -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef upgrade
sudo apt-get -yqq install mc zsh git less htop wget tmux uidmap emacs-nox

sh -c "$(curl -fsSL https://install.ohmyz.sh/)" "" --unattended
sudo chsh -s $(which zsh) $(whoami)

cat > .zshrc <<'EOF'
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="mymuse"
COMPLETION_WAITING_DOTS="true"
plugins=(
  git
  docker
  bundler
  rake
  rbenv
  ruby
  rails
)
source $ZSH/oh-my-zsh.sh

alias clcl="clear && clear"
alias gs="gss"
alias dcp="docker compose -f docker-compose.yml"
alias dce="dcp exec app"
alias dcbe="dce bin/bundle exec"

alias gskipped='git ls-files -v | grep "^S"'
alias gskip='git update-index --skip-worktree'
alias gunskip='git update-index --no-skip-worktree'
EOF

cat > .oh-my-zsh/custom/themes/mymuse.zsh-theme <<'EOF'
PROMPT="${FG[077]}$HOST%{$reset_color%} ${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}ᐅ%{$reset_color%} "

ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}("
ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" ${FG[133]}✘"
ZSH_THEME_GIT_PROMPT_CLEAN=" ${FG[118]}✔"

ZSH_THEME_GIT_PROMPT_ADDED="${FG[082]}✚%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_MODIFIED="${FG[166]}✹%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DELETED="${FG[160]}✖%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_RENAMED="${FG[220]}➜%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNMERGED="${FG[082]}═%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="${FG[190]}✭%{$reset_color%}"

ZSH_THEME_VIRTUALENV_PREFIX=" ["
ZSH_THEME_VIRTUALENV_SUFFIX="]"
EOF

wget https://get.docker.com/ -O docker-install.sh
chmod +x docker-install.sh

